package com.exsun.ex1077.ui.activity.web

import android.os.Bundle
import com.exsun.ex1077.databinding.ActivityWebBinding
import com.zhangping.fastjetpack.base.BaseActivity
import com.zhangping.fastjetpack.base.BaseViewModel
import android.widget.LinearLayout

import com.just.agentweb.AgentWeb
import kotlinx.android.synthetic.main.activity_web.*


/**
 * 描述：H5页面
 * 作者：ZhangPing
 * 创建时间：2022/8/31 10:29
 */
class WebActivity : BaseActivity<BaseViewModel, ActivityWebBinding>(){

    override fun title() = intent.getStringExtra("title") ?: "标题"

    private var agentWeb: AgentWeb? = null

    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.vm = mViewModel
        super.initView(savedInstanceState)
        val url = intent.getStringExtra("url") ?: "https://m.baidu.com"
        agentWeb = AgentWeb.with(this)
            .setAgentWebParent(webView!!, LinearLayout.LayoutParams(-1, -1))
            .useDefaultIndicator()
            .createAgentWeb()
            .ready()
            .go(url)
    }

}